import { PageVo, ResultPageData } from "@/api/interface/index";
import http from "@/api";
export namespace User {
  export interface UserSearchVo extends PageVo {
    username: string;
    nickname: string;
  }
  export interface UserInsertVo {
    username: string;
    nickname: string;
    avatar: string;
    password: string;
    gender: boolean;
    phone: string;
    departmentId: string;
    roleId: string;
    remark: string;
    type: number;
  }
  export interface UserOut {
    userId: string;
    username: string;
    nickname: string;
    avatar: string;
    password: string;
    gender: boolean;
    phone: string;
    departmentId: string;
    roleId: string;
    remark: string;
  }
  export interface UserUpdateVo {
    userId: string;
    username: string;
    nickname: string;
    avatar: string;
    gender: boolean;
    phone: string;
    departmentId: string;
    roleId: string;
    remark: string;
  }
  export interface UserPageOut {
    userId: string;
    username: string;
    nickname: string;
    avatar: string;
    gender: boolean;
    genderMean: string;
    status: number;
    statusMean: string;
    phone: string;
  }
}
// 获取用户列表
export const getUserList = (params: User.UserSearchVo) => {
  return http.post<ResultPageData<User.UserPageOut>>("/admin/adminUser/userPage", params);
};
// 添加用户
export const addUser = (params: User.UserInsertVo) => {
  return http.post("/admin/adminUser/insert", params);
};

// 根据id获取用户
export const getUserById = (id: string) => {
  return http.get<User.UserOut>("/admin/adminUser/selectById", { id: id });
};
// 更新用户信息
export const updateUser = (params: User.UserUpdateVo) => {
  return http.post("/admin/adminUser/update", params);
};
// 删除用户信息
export const deleteUser = (id: string) => {
  return http.delete("/admin/adminUser/delete", { id: id });
};
